#include <bits/stdc++.h>

using namespace std;
int lowerBound1(int a[],int l,int r,int x)
{
    int mid;
    while (l<r)
    {
        mid=(l+r)>>1;
        if (a[mid]>=x)
        {
            r=mid;
        }
        else
        {
            l=mid+1;
        }
    }
    return l;
}
int upperBound1(int a[],int l,int r,int x)
{
    int mid;
    while (l<r)
    {
        mid=(l+r+1)>>1;
        if (a[mid]<=x)
        {
            l=mid;
        }
        else
        {
            r=mid-1;
        }
    }
    return l;
}
int main_17()
{
    srand(5);
    int len=rand()%20,span=50;
    int arr[len]={0};//5 10 14 21 22 26 26 27 30 33 40 43 49 49
    for (int i=0;i<len ;++i )
    {
        arr[i]=rand()%span;
    }
    sort(arr,arr+len);
    for (int i=0;i<len ;++i )
    {
        printf("%d ",arr[i]);
    }
    putchar('\n');
    printf("%d\n",lowerBound1(arr,0,len,26));
    printf("%d\n",upperBound1(arr,0,len,26));
    return 0;
}
